<?php
defined('_JEXEC') or die;

// disable core styles to avoid bs conflict
OC_Util::$core_styles = array();

?>

<?php foreach ($_['examPaper'] as $k => $v):?>
<?php
if (!is_int($k))
   continue;
$op_label = array('A','B','C','D','E','F','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');

switch ($v->type) {
   case 'singleanswer':
      ?>
      <div class="test_questionbox">
         <h6><?=$k+$_['start']+1;?>. <? echo $v->question_img ? "<img src='".$v->question_img."'>" : $v->question;?></h6>
         <div class="test_question_select normal">
            <?php foreach ($v->answer as $key => $choice):?>
            <label class="radio">
               <input type="radio" class="each_answer" name="<?=$v->questionid?>" value="<?=$key+1?>"/>
               <?=$op_label[$key]?>. <?php echo htmlspecialchars($choice->choice);?>
            </label>
            <?php endforeach;?>
         </div>
      </div>
      <?php
      break;
   case 'multipleanswer':
      ?>
      <div class="test_questionbox">
         <h6><?=$k+$_['start']+1;?>. <? echo $v->question_img ? "<img src='".$v->question_img."'>" : $v->question;?></h6>
         <div class="test_question_select normal">
            <?php foreach ($v->answer as $key => $choice):?>
            <label class="checkbox">
               <input type="checkbox" class="each_answer" name="<?=$v->questionid?>" value="<?=$key+1?>"/>
               <?=$op_label[$key]?>. <?php echo htmlspecialchars($choice->choice);?>
            </label>
            <?php endforeach;?>
         </div>
      </div>
      <?php
      break;
   case 'freeinput':
      ?>
      <div class="test_questionbox">
         <h6><?=$k+$_['start']+1;?>. <? echo $v->question_img ? "<img src='".$v->question_img."'>" : $v->question;?></h6>
         <div class="test_question_textarea normal">
            <textarea name="<?=$v->questionid?>" class="each_answer"></textarea>
         </div>
      </div>
      <?php
      break;
   // make default to singleanswer
   default:
      ?>
      <div class="test_questionbox">
         <h6><?=$k+$_['start']+1;?>. <? echo $v->question_img ? "<img src='".$v->question_img."'>" : $v->question;?></h6>
         <div class="test_question_select normal">
            <?php foreach ($v->answer as $key => $choice):?>
            <label class="radio">
               <input type="radio" class="each_answer" name="<?=$v->questionid?>" value="<?=$key+1?>"/>
               <?=$op_label[$key]?>. <?php echo htmlspecialchars($choice->choice);?>
            </label>
            <?php endforeach;?>
         </div>
      </div>
      <?php
      break;
}
?>
<?php endforeach;?>
